﻿@model Site3AI.Models.CmsItem

@{
    ViewBag.Title = "Edit";
}

<h2>Edit</h2>

@using (Html.BeginForm())
{
    @Html.AntiForgeryToken()
    @Html.ValidationSummary(true)

    <fieldset>
        <legend>CmsItem</legend>

        @Html.HiddenFor(model => model.ID)

        <div class="editor-label">
            @Html.LabelFor(model => model.CmsCatalogID)
        </div>
        <div class="editor-field">
            @{
    var sl = (ViewBag.CmsCatalogs as IEnumerable<Site3AI.Models.CmsCatalog>).Where(v => v.ID != Model.ID).Select(v => new { ID = v.ID, Title = "[" + v.Title + ":" + v.ID + "]" + string.Join(",", v.Hospitals.Select(j => j.HospCode).ToArray()) });
            }
            @Html.DropDownListFor(model => model.CmsCatalogID, new SelectList(sl, "ID", "Title", Model.CmsCatalogID))

            @Html.ValidationMessageFor(model => model.CmsCatalogID)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Title)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Title)
            @Html.ValidationMessageFor(model => model.Title)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.TitleShort)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.TitleShort)
            @Html.ValidationMessageFor(model => model.TitleShort)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.UpdateTime)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.UpdateTime)
            @Html.ValidationMessageFor(model => model.UpdateTime)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.SortIdx)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.SortIdx)
            @Html.ValidationMessageFor(model => model.SortIdx)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.TextContent)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.TextContent)
            @Html.ValidationMessageFor(model => model.TextContent)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.HtmlContent)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.HtmlContent, "Html")
            @Html.ValidationMessageFor(model => model.HtmlContent)
        </div>

        <p>
            <input type="submit" value="Save" />
        </p>
    </fieldset>
}

<div>
    @Html.ActionLink("Back to List", "Index")
</div>

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
    <link type="text/javascript" rel="@Url.Content("~/Scripts/ckeditor/ckeditor.js")"/>

    <script type="text/javascript" src="@Url.Content("~/Scripts/ckeditor/ckeditor.js")"></script>

}
